package com.chenbei.erp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chenbei.erp.domain.PurchaseOrderDetail;
import com.chenbei.erp.mapper.PurchaseOrderDetailMapper;
import com.chenbei.erp.service.IPurchaseOrderDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class PurchaseOrderDetailService extends ServiceImpl<PurchaseOrderDetailMapper, PurchaseOrderDetail> implements IPurchaseOrderDetailService {

    @Override
    public void removeByPurchaseOrderId(Long orderId) {
        LambdaQueryWrapper<PurchaseOrderDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(PurchaseOrderDetail::getOrderId, orderId);
        remove(lambdaQueryWrapper);
    }

    @Override
    public List<PurchaseOrderDetail> listByPurchaseOrderId(Long orderId) {
        LambdaQueryWrapper<PurchaseOrderDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(PurchaseOrderDetail::getOrderId, orderId);
        return list(lambdaQueryWrapper);
    }
}
